﻿@using System.Linq;
<div class="box">
    <div class="left topmenu" id="topmenu">
        <ul>
            <li class="item home-item" title="后台首页"><a href="@Url.ActionUrl("Home")" target="mainContainer"><i class="glyphicon glyphicon-home"></i></a></li>
            @{
                string homeLink= (string)ViewData["HomeLink"];
                int maxShow=6;
                IEnumerable<dynamic> menuList = (IEnumerable<dynamic>)ViewData["MenuList"];
                menuList = menuList.Where(item => item.Level == 1).OrderBy(item => item.Xuhao);
                int rowsCount = menuList.Count();
                int i = 0;
                foreach (var item in menuList)
                {
                    if (i < maxShow)
                    {
                        <li class="item menu-item" date-top-menu-id="@item.Id"><span>@item.Name</span></li>
                    }
                    i++;
                }
                i = 0;
                if (maxShow < rowsCount)
                {
                    <li class="item dropdown dropdown-hover menu-item">
                        <span class="dropdown-toggle" data-toggle="dropdown">
                            更多<b class="caret"></b>
                        </span>
                        <ul class="dropdown-menu">
                            @foreach (var item in menuList)
                            {
                                if (i >= maxShow)
                                {
                                    <li class="menu-item" date-top-menu-id="@item.Id"><i class="glyphicon glyphicon-chevron-right"></i><span>@item.Name</span></li>
                                }
                                i++;
                            }
                        </ul>
                    </li>
                }
            }
        </ul>
    </div>
    <div class="right">
        <ul>
            <li class="item item-webhome" title="网站首页" data-toggle="tooltip" data-placement="bottom"><a href="@homeLink" target="_blank"><i class="glyphicon glyphicon-globe"></i></a></li>
            <li class="item item-shopping-cart dropdown-hover hidden" data-toggle="tooltip" data-placement="bottom"><a><span class="glyphicon glyphicon-shopping-cart"></span><span class="badge">0</span></a></li>
            <li class="item item-msg dropdown dropdown-hover hidden" data-toggle="tooltip" data-placement="bottom"><a><span class="glyphicon glyphicon-bell"></span><span class="badge badge">0</span></a></li>
            <li class="item item-mylogin dropdown dropdown-hover">
                <a  class="dropdown-toggle" data-toggle="dropdown">&nbsp;&nbsp;<span class="glyphicon glyphicon-user"> </span>账户中心<b class="caret"></b></a>
                <ul class="dropdown-menu pull-right">
                    <li><a href="@Url.ActionUrl("Home","Default")"><i class="glyphicon glyphicon-home"></i>会员首页</a></li>
                    <li><a href="#" onclick="Exit()"><i class="glyphicon glyphicon-off"></i>退出登录</a></li>
                    <li><a href="@homeLink" target="_blank"><i class="glyphicon glyphicon-link"></i>网站首页</a></li>
                </ul>
            </li>
        </ul>
    </div>
</div>
<script>
    var $tooltip = $("[data-toggle='tooltip']");
    $(function () { $tooltip.tooltip(); });
    //$(".newNotice").tooltip('show');


    function Exit() {
        Msg("loading...")
        var url = "@Url.ActionUrl("Exit","Login")";
        var Data = Ajax({ type: "get", async: true, url: url }, function () {
          location.href ="@Url.ActionUrl("Index","Login")";
        });
    }
</script>

